<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/views1/DTD/views1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">
	<ui:composition template="/views/layout/main.xhtml">
		<ui:define name="conteudo">
			<h:form id="formPrincipal">
				<div class="grid_18 div_48">
					<p:commandButton id="btn_Novo" ajax="false"
						action="#{ofertaDisciplinaBean.goCreate}" title="Cadastrar"
						styleClass="add-notes" />
					<c:if test="#{ofertaDisciplinaBean.ofertaInstance.id > 0}">
						<p:commandButton id="btn_Editar" ajax="false" styleClass="edit-notes"
							action="#{ofertaDisciplinaBean.goEdit}" title="Editar" />
						<p:commandButton id="btn_Desistir" immediate="true" ajax="false" styleClass="cancel"
							action="#{ofertaDisciplinaBean.desistir}" title="Desistir" />
					</c:if>
					<p:commandButton id="btn_Buscar" type="button" ajax="false"
						title="Buscar" onclick="promptBuscaOfertaDisciplina.show();"
						styleClass="search-notes" />
					<c:if test="#{ofertaDisciplinaBean.ofertaInstance.id > 0}">
						<p:commandButton id="btn_Finalizar" immediate="true" ajax="false" styleClass="edit-notes"
							action="#{ofertaDisciplinaBean.finalizar}" title="Finalizar" />
					</c:if>
					<p:commandButton id="btn_Home" ajax="false"
						action="#{ofertaDisciplinaBean.goHome}" title="Home"
						styleClass="home" />
				</div>

				<div class="grid_18 titulo">Ofertas de Disciplinas</div>

				<div class="grid_18">
					<p:messages id="mensages" showSummary="false" showDetail="true" />
				</div>

				<div class="grid_4 div-label">Ano/Semestre:</div>
				<div class="grid_14 div-campo">
					<p:inputText id="oferta_data" disabled="true" styleClass="width_3"
						value="#{ofertaDisciplinaBean.ofertaInstance.ano}">
						<f:convertDateTime pattern="yyyy"></f:convertDateTime>
					</p:inputText>
					<p:spacer width="2" height="1" />
					/
					<p:spacer width="2" height="1" />
					<p:inputText id="oferta_semestre" disabled="true"
						styleClass="width_2"
						value="#{ofertaDisciplinaBean.ofertaInstance.semestre}" />
				</div>

				<div class="grid_4 div-label">Disciplina:</div>
				<div class="grid_14 div-campo">
					<p:inputText id="oferta_disciplina_disciplina" disabled="true"
						widgetVar="oferta_disciplina_disciplina" styleClass="width_9"
						value="#{ofertaDisciplinaBean.ofertaInstance.disciplina.nome}" />
				</div>

				<div class="grid_4 div-label">Professor:</div>
				<div class="grid_14 div-campo">
					<p:inputText id="oferta_disciplina_professor" disabled="true"
						widgetVar="oferta_disciplina_professor" styleClass="width_9"
						value="#{ofertaDisciplinaBean.ofertaInstance.professor.nomeCompleto}" />
				</div>

				<div class="grid_18 subtitulo">Alunos</div>
				<div class="clear"></div>
				<div class="grid_18">
					<p:dataTable id="dataTableAlunos" paginator="true"
						selection="#{ofertaDisciplinaBean.alunoOfertaInstance}"
						value="#{ofertaDisciplinaBean.alunoOfertaList}"
						selectionMode="single" var="a"
						emptyMessage="Nenhum registro encontrado!" rows="10"
						dynamic="true">
						<p:column headerText="Matricula" sortBy="#{a.aluno.matricula}">
							<h:outputText value="#{a.aluno.matricula}" />
						</p:column>
						<p:column headerText="Nome" sortBy="#{a.aluno.nomeCompleto}">
							<h:outputText value="#{a.aluno.nomeCompleto}" />
						</p:column>
					</p:dataTable>
				</div>
			</h:form>

			<!-- INCLUSAO DE OUTROS XHTMLs -->
			<ui:include src="/views/ofertasDisciplinas/_promptBuscaOfertaDisciplina.xhtml" />
		</ui:define>
	</ui:composition>
</f:view>